import { useIntl } from 'umi';
import { InfoBlock } from '../../components/InfohasUnit/InfoBlock';
import { InfoField } from '../../components/InfohasUnit/InfoField';
//单体温度 电压
import { ModuleOverview } from '../../components/module/index';
interface IProps {
  data: API.BmuRealtimeDTO;
}

export const Info: React.FC<IProps> = ({ data }) => {
  const intl = useIntl();
  const Items = [
    {
      label: intl.formatMessage({ id: 'stationRealtimeMonitoring.current' }),
      value: data?.bmuOverviewDto?.current,
      unit: 'A',
    },
    {
      label: intl.formatMessage({ id: 'stationRealtimeMonitoring.balancedCurrent' }),
      value: data?.bmuOverviewDto?.bcurrent,
      unit: 'A',
    },
    {
      label: intl.formatMessage({ id: 'stationRealtimeMonitoring.totalVoltageOfModule' }),
      value: data?.bmuOverviewDto?.voltage,
      unit: 'V',
    },
    {
      label: intl.formatMessage({ id: 'stationRealtimeMonitoring.averageVoltageOfCells' }),
      value: data?.bmuOverviewDto?.cellAvgVol,
      unit: 'V',
    },
    {
      label: intl.formatMessage({ id: 'stationRealtimeMonitoring.averageTemperatureOfCells' }),
      value: data?.bmuOverviewDto?.cellAvgTemp,
      unit: '℃',
    },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.vmax' }),
    //   value: data?.bmuOverviewDto?.vmax,
    //   unit: 'V',
    // },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.vmaxPosition' }),
    //   value: data?.bmuOverviewDto?.vmaxIdx,
    // },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.vmin' }),
    //   value: data?.bmuOverviewDto?.vmin,
    //   unit: 'V',
    // },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.vminPosition' }),
    //   value: data?.bmuOverviewDto?.vminIdx,
    // },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.tmax' }),
    //   value: data?.bmuOverviewDto?.tmax,
    //   unit: '℃',
    // },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.tmaxPosition' }),
    //   value: data?.bmuOverviewDto?.tmaxIdx,
    // },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.tmin' }),
    //   value: data?.bmuOverviewDto?.tmin,
    //   unit: '℃',
    // },
    // {
    //   label: intl.formatMessage({ id: 'stationRealtimeMonitoring.tminPosition' }),
    //   value: data?.bmuOverviewDto?.tminIdx,
    // },
  ];

  // siteManage.baseInfo
  return (
    <div style={{ padding: '20px 30px', marginBottom: 10 }}>
      <InfoBlock title={intl.formatMessage({ id: 'siteManage.baseInfo' })}>
        {Items.map((item, index) => (
          <InfoField key={index} label={item.label} value={item.value} unit={item?.unit} />
        ))}
      </InfoBlock>
      <ModuleOverview
        maxData={{
          tempList: data?.extreme?.tempList,
          voltageList: data?.extreme?.voltageList,
        }}
      />
    </div>
  );
};
